color = "blue"
stage.set_background("silo")
stage.create_grid_overlay(50, color)
def click_2():
stage.set_background("silo")
q1.set_text('')
q2.set_text('')
q3.set_text('')
q4.set_text('')
stage.event_click(click_1)
def click_1():
stage.set_background('grid')
global q1
global q2
global q3
global q4
q1 = codesters.Text("Quad 1", 210, 210, color)
q2 = codesters.Text("Quad 2", -210, 210, color)
q3 = codesters.Text("Quad 3", -210, -210, color)
q4 = codesters.Text("Quad 4", 210, -210, color)
stage.event_click(click_2)
stage.event_click(click_1)
x1 = 200
y1 = 50
x2 = -225
y2 = 200
x3 = -50
y3 = -200
x4 = 150
y4 = -100
color = "cornflowerblue"
q1_sprite = codesters.Sprite("butterfly", x1, y1)
q1_sprite.set_size(.5)
q2_sprite = codesters.Sprite("rocket", x2, y2)
q2_sprite.set_size(.3)
q3_sprite = codesters.Sprite("bike", x3, y3)
q3_sprite.set_size(.5)
q4_sprite = codesters.Sprite("cow", x4, y4)
q4_sprite.set_size(.3)
stage.set_background("silo")
sprite = codesters.Sprite("person12")
sprite.set_size(.5)
sprite.go_to(0, 0)
sprite.glide_to(-200, -50)
t = codesters.Teacher()
# try:
# tvalx1 = int(t.get_parameters_for_function('glide_to')[0][0])
# avalx1 = abs(tvalx1 - x1)
# tvaly1 = int(t.get_parameters_for_function('glide_to')[0][1])
# avaly1 = abs(tvaly1 - y1)
# except:
# tvalx1 = "DNE"
# tvaly1 = "DNE"
# avalx1 = "DNE"
# avaly1 = "DNE"
# try:
# tvalx2 = int(t.get_parameters_for_function('glide_to')[1][0])
# avalx2 = abs(tvalx2 - x2)
# tvaly2 = int(t.get_parameters_for_function('glide_to')[1][1])
# avaly2 = abs(tvaly2 - y2)
# except:
# tvalx2 = "DNE"
# tvaly2 = "DNE"
# avalx2 = "DNE"
# avaly2 = "DNE"
try:
tvalx3 = int(t.get_parameters_for_function('glide_to')[0][0])
avalx3 = abs(tvalx3 - x3)
tvaly3 = int(t.get_parameters_for_function('glide_to')[0][1])
avaly3 = abs(tvaly3 - y3)
except:
tvalx3 = "DNE"
tvaly3 = "DNE"
avalx3 = "DNE"
avaly3 = "DNE"
# try:
# tvalx4 = int(t.get_parameters_for_function('glide_to')[3][0])
# avalx4= abs(tvalx4 - x4)
# tvaly4 = int(t.get_parameters_for_function('glide_to')[3][1])
# avaly4 = abs(tvaly4 - y4)
# except:
# tvalx4 = "DNE"
# tvaly4 = "DNE"
# avalx4 = "DNE"
# avaly4 = "DNE"
# try:
# tvalx5 = int(t.get_parameters_for_function('glide_to')[0][0])
# tvaly5 = int(t.get_parameters_for_function('glide_to')[0][1])
# except:
# tvalx5 = "DNE"
# tvaly5 = "DNE"
dev = 26
# t1 = TestObjective()
# t1.add_success(avalx1 <= dev and avaly1 <= dev, "Great job debugging the program!")
# t1.add_failure(tvalx1 == "DNE", "Oops! Did you delete a Glide To command?")
# t1.add_failure(avalx1 >= dev or avaly1 >= dev, "Try to get closer to the butterfly's coordinate!")
# t2 = TestObjective()
# t2.add_success(avalx2 <= dev and avaly2 <= dev, "Great job! You got to the Rocket!")
# t2.add_failure(tvalx2 == "DNE", "Oops! Did you delete a Glide To command?")
# t2.add_failure(avalx2 >= dev or avaly2 >= dev, "Try to get closer to the rocket's coordinate!")
t3 = TestObjective()
t3.add_success(avalx3 <= dev and avaly3 <= dev, "Great job debugging the program!")
t3.add_failure(tvalx3 == "DNE", "Oops! Did you delete the Glide To command?")
t3.add_failure(tvalx3 == 50, "Oops! Check whether the x-coordinate should be a negative number.")
t3.add_failure(tvaly3 == 200, "Oops! Check whether the y-coordinate should be a negative number.")
t3.add_failure(avalx3 >= dev, "Try changing the x-coordinate to get closer to the bike!")
t3.add_failure(avaly3 >= dev, "Try changing the y-coordinate to get closer to the bike!")
# t4 = TestObjective()
# t4.add_success(avalx4 <= dev and avaly4 <= dev, "Great job! You got to the cow!")
# t4.add_failure(tvalx4 == "DNE", "Oops! Did you delete a Glide To command?")
# t4.add_failure(avalx4 >= dev or avaly4 >= dev, "Try to get closer to the cow's coordinate!")
tester = TestManager()
tester.add_test_list([t3])
tester.run_tests()
tester.display_first_feedback()